<?php

include("../inc/config.php");   // include database information
include("../inc/errors.php");   // include error profiles



//connect to mysql database for all files
$mysql['connection'] = mysql_connect($databaseinfo['host'], $databaseinfo['user'], $databaseinfo['password'])
or die ($error['connection']);

//select mysql database
$mysql['db'] = mysql_select_db($databaseinfo['dbname'],$mysql['connection'])
or die ($error['database']);



$sql = 'CREATE TABLE `gconfig` ('
        . ' `id` INT(5) NOT NULL AUTO_INCREMENT PRIMARY KEY, '
        . ' `name` VARCHAR(100) NOT NULL, '
        . ' `v1` VARCHAR(5) NOT NULL, '
        . ' `v2` VARCHAR(5) NOT NULL, '
        . ' `v3` VARCHAR(1000) NOT NULL'
        . ' )'
        . ' ENGINE = innodb;';
$res = mysql_query($sql);


$sql = 'CREATE TABLE `help` ('
        . ' `id` INT(5) NOT NULL AUTO_INCREMENT PRIMARY KEY, '
        . ' `topic_title` VARCHAR(100) NOT NULL, '
        . ' `topic_text` VARCHAR(5000) NOT NULL'
        . ' )'
        . ' ENGINE = innodb;';
$res = mysql_query($sql);
$sql = 'CREATE TABLE `banlist` ('
        . ' `id` INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY, '
        . ' `ip` VARCHAR(15) NOT NULL, '
        . ' `banned_by` VARCHAR(20) NOT NULL, '
        . ' `reason` VARCHAR(5000) NOT NULL, '
        . ' `timestamp` VARCHAR(12) NOT NULL'
        . ' )'
        . ' ENGINE = innodb;';
$res = mysql_query($sql);

$sql = 'CREATE TABLE `users` ('
        . ' `id` INT(15) NOT NULL AUTO_INCREMENT PRIMARY KEY, '
        . ' `user_name` VARCHAR(100) NOT NULL, '
        . ' `full_name` VARCHAR(150) NOT NULL, '
        . ' `email` VARCHAR(100) NOT NULL, '
        . ' `password` VARCHAR(32) NOT NULL, '
        . ' `timestamp` VARCHAR(15) NOT NULL, '
        . ' `ip` VARCHAR(15) NOT NULL, '
        . ' `msn` VARCHAR(100) NOT NULL, '
        . ' `aim` VARCHAR(100) NOT NULL, '
        . ' `yahoo` VARCHAR(100) NOT NULL, '
        . ' `skype` VARCHAR(100) NOT NULL, '
        . ' `display_picture` VARCHAR(150) NOT NULL, '
        . ' `rank_id` VARCHAR(15) NOT NULL'
        . ' )'
        . ' ENGINE = innodb;';
$res = mysql_query($sql);
$sql = 'CREATE TABLE `userlogin` ('
        . ' `id` INT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY, '
        . ' `user_id` VARCHAR(15) NOT NULL, '
        . ' `rank_id` VARCHAR(15) NOT NULL, '
        . ' `timestamp` VARCHAR(15) NOT NULL, '
        . ' `ip` VARCHAR(15) NOT NULL,'
        . ' INDEX (`user_id`)'
        . ' )'
        . ' ENGINE = innodb;';
$res = mysql_query($sql);
$sql = 'CREATE TABLE `cookielog` ('
        . ' `id` INT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY, '
        . ' `user_id` VARCHAR(15) NOT NULL, '
        . ' `rank_id` VARCHAR(15) NOT NULL, '
        . ' `cookie_id` VARCHAR(32) NOT NULL, '
        . ' `timestamp` VARCHAR(15) NOT NULL, '
        . ' `ip` VARCHAR(15) NOT NULL,'
        . ' INDEX (`user_id`)'
        . ' )'
        . ' ENGINE = innodb;';
$res = mysql_query($sql);
$sql = 'CREATE TABLE `themes` ('
        . ' `id` INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY, '
        . ' `theme_name` VARCHAR(100) NOT NULL, '
        . ' `theme_author` VARCHAR(100) NOT NULL, '
        . ' `theme_dir` VARCHAR(200) NOT NULL, '
        . ' `base_dir` VARCHAR(50) NOT NULL, '
        . ' `timestamp` VARCHAR(15) NOT NULL, '
        . ' `theme_selected` VARCHAR(1) NOT NULL'
        . ' )'
        . ' ENGINE = innodb;';
$res = mysql_query($sql);
$sql = 'CREATE TABLE `templates` ('
        . ' `id` INT(15) NOT NULL AUTO_INCREMENT PRIMARY KEY, '
        . ' `template_name` VARCHAR(100) NOT NULL, '
        . ' `template_author` VARCHAR(100) NOT NULL, '
        . ' `timestamp` VARCHAR(15) NOT NULL, '
        . ' `html_article` VARCHAR(5000) NOT NULL, '
        . ' `html_comment` VARCHAR(5000) NOT NULL, '
        . ' `html_form` VARCHAR(5000) NOT NULL, '
        . ' `template_selected` VARCHAR(1) NOT NULL'
        . ' )'
        . ' ENGINE = innodb;';

$res = mysql_query($sql);
$sql = 'CREATE TABLE `categories` ('
        . ' `id` INT(15) NOT NULL AUTO_INCREMENT PRIMARY KEY, '
        . ' `cat_name` VARCHAR(100) NOT NULL, '
        . ' `cat_author` VARCHAR(100) NOT NULL, '
        . ' `cat_desc` VARCHAR(1000) NOT NULL, '
        . ' `timestamp` VARCHAR(15) NOT NULL, '
        . ' `ip` VARCHAR(15) NOT NULL'
        . ' )'
        . ' ENGINE = innodb;';
$res = mysql_query($sql);
$sql = 'CREATE TABLE `ranks` ('
        . ' `id` INT(15) NOT NULL AUTO_INCREMENT PRIMARY KEY, '
        . ' `rank_title` VARCHAR(100) NOT NULL, '
        . ' `rank_desc` VARCHAR(1000) NOT NULL, '
        . ' `rank_author` VARCHAR(100) NOT NULL, '
        . ' `timestamp` VARCHAR(15) NOT NULL, '
        . ' `option1` VARCHAR(1) NOT NULL, '
        . ' `option2` VARCHAR(1) NOT NULL, '
        . ' `option3` VARCHAR(1) NOT NULL, '
        . ' `option4` VARCHAR(1) NOT NULL, '
        . ' `option5` VARCHAR(1) NOT NULL, '
        . ' `option6` VARCHAR(1) NOT NULL, '
        . ' `option7` VARCHAR(1) NOT NULL, '
        . ' `option8` VARCHAR(1) NOT NULL, '
        . ' `option9` VARCHAR(1) NOT NULL, '
        . ' `option10` VARCHAR(1) NOT NULL'
        . ' )'
        . ' ENGINE = innodb;';
$res = mysql_query($sql);

$sql = 'CREATE TABLE `articles` ('
        . ' `id` INT(25) NOT NULL AUTO_INCREMENT PRIMARY KEY, '
        . ' `article_title` VARCHAR(100) NOT NULL, '
        . ' `article_subtitle` VARCHAR(100) NOT NULL, '
        . ' `article_author` VARCHAR(100) NOT NULL, '
        . ' `article_cat` VARCHAR(15) NOT NULL, '
        . ' `article_text` VARCHAR(20000) NOT NULL, '
        . ' `article_exptext` VARCHAR(20000) NOT NULL, '
        . ' `article_imgid` VARCHAR(100) NOT NULL, '
        . ' `allow_comments` VARCHAR(1) NOT NULL, '
        . ' `start_date` VARCHAR(15) NOT NULL, '
        . ' `end_date` VARCHAR(15) NOT NULL, '
        . ' `active` VARCHAR(1) NOT NULL, '
        . ' `approved` VARCHAR(1) NOT NULL, '
        . ' `archived` VARCHAR(1) NOT NULL, '
        . ' `timestamp` VARCHAR(15) NOT NULL, '
        . ' `ip` VARCHAR(15) NOT NULL,'
        . ' INDEX (`article_title`, `timestamp`)'
        . ' )'
        . ' ENGINE = innodb;';
$res = mysql_query($sql);
$sql = 'CREATE TABLE `images` ('
        . ' `id` INT(15) NOT NULL AUTO_INCREMENT PRIMARY KEY, '
        . ' `user_id` VARCHAR(15) NOT NULL, '
        . ' `image_filepath` VARCHAR(500) NOT NULL, '
        . ' `alt_description` VARCHAR(100) NOT NULL, '
        . ' `timestamp` VARCHAR(15) NOT NULL, '
        . ' `ip` VARCHAR(15) NOT NULL,'
        . ' INDEX (`user_id`)'
        . ' )'
        . ' ENGINE = innodb;';
$res = mysql_query($sql);
$sql = 'CREATE TABLE `comments` ('
        . ' `id` INT(25) NOT NULL AUTO_INCREMENT PRIMARY KEY, '
        . ' `article_id` VARCHAR(25) NOT NULL, '
        . ' `comment_text` VARCHAR(1000) NOT NULL, '
        . ' `comment_author` VARCHAR(20) NOT NULL, '
        . ' `timestamp` VARCHAR(15) NOT NULL, '
        . ' `approved` VARCHAR(1) NOT NULL, '
        . ' `ip` VARCHAR(15) NOT NULL'
        . ' )'
        . ' ENGINE = innodb;';
$res = mysql_query($sql);
$sql = 'CREATE TABLE `messages` ('
        . ' `id` INT(15) NOT NULL AUTO_INCREMENT PRIMARY KEY, '
        . ' `priority` VARCHAR(1) NOT NULL, '
        . ' `message_title` VARCHAR(100) NOT NULL, '
        . ' `message_text` VARCHAR(10000) NOT NULL, '
        . ' `message_author` VARCHAR(100) NOT NULL, '
        . ' `ip` VARCHAR(15) NOT NULL'
        . ' )'
        . ' ENGINE = innodb;';






$sql = 'INSERT INTO `gconfig` (`id`, `name`, `v1`, `v2`, `v3`) VALUES (NULL, \'siteonline\', \'0\', \'0\', \'0\');';
$res = mysql_query($sql);


?>








